<template>
  <div class="exhibits-content" :style="{ width: props.info.width + 'rem', height: props.info.height + 'rem' }">
    <div class="list">
      <div
        class="decoration-box"
        :style="{
          backgroundImage: `url(${publicUrls + 'free/style5/exhibitionStandStyle1bg1.webp'})`,
        }"
      ></div>  
      <div
        class="list-content"
        :style="{
          backgroundImage: `url(${publicUrls + 'free/style5/exhibitionStandStyle1bg3.webp'})`,
        }"
      >
        <div
          class="list-left"
          :style="{
            backgroundImage: `url(${publicUrls + 'free/style5/exhibitionStandStyle1bg2.webp'})`,
          }"
        ></div>
        <div
          @contextmenu.stop="emit('onContextMenuChild', $event, index)"
          v-for="(item, index) in props.info.showpieceList"
          :key="index"
          class="exhibits-item"
          :style="{
            backgroundImage: `url(${publicUrls + 'free/style5/exhibitionStandStyle1bg5.webp'})`,
          }"
        >
          <div class="item-content">
            <div @click="viewImg(item.moduleId, item.id)" class="cover-box">
              <div class="flip-box">
                <div class="flip-box-inner">
                  <div
                    class="flip-box-front"
                    :style="{
                      backgroundImage: `url(${
                        publicUrls + 'free/style5/exhibitionStandStyle1bg6.webp'
                      })`,
                    }"
                  >
                    <div class="flip-box-front-content">
                      <img class="cover" v-lazy="getLinkUrl(item.coverUrl, '?imageView2/3/w/600/format/webp')" alt="" />
                      <FlowerCom />
                    </div>
                  </div>
                  <div
                    class="flip-box-back"
                    :style="{
                      backgroundImage: `url(${
                        publicUrls + 'free/style5/exhibitionStandStyle1bg6.webp'
                      })`,
                    }"
                  >
                    <p>{{ item.name }}</p>
                  </div>
                </div>
              </div>
              <!-- <div
                class="flip-box-front"
                :style="{
                  backgroundImage: `url(${
                    publicUrls + 'free/style5/exhibitionStandStyle1bg6.webp'
                  })`,
                }"
              >
                <div class="front-content">
                  <img class="cover" v-lazy="getLinkUrl(item.coverUrl, '?imageView2/3/w/600/format/webp')" alt="" />
                  <FlowerCom />
                </div>
              </div>
              <div
                class="items-title flip-box-back"
                :style="{
                  backgroundImage: `url(${
                    publicUrls + 'free/style5/exhibitionStandStyle1bg6.webp'
                  })`,
                }"
              >
                <p>{{ item.name }}</p>
              </div> -->
            </div>
          </div>
        </div>
        <div
          class="list-right"
          :style="{
            backgroundImage: `url(${publicUrls + 'free/style5/exhibitionStandStyle1bg4.webp'})`,
          }"
        ></div>
      </div>
    </div>
  </div>
</template> 
 
<script setup lang="ts">
import FlowerCom from '../../displayBoard/style5/flower.vue';
import { publicUrls } from '@/utils/minxin';
import { DraggableContainer } from 'vue3-draggable-resizable';
// import FlotMenu from '@/components/flotMenu/OutlineMenu.vue';
import ContextMenu from '@imengyu/vue3-context-menu';
import { getDraggableNumber, getExhibitsHeightRest, getdisabledY } from '@/utils/getRemComputed';
import { ref, reactive, watch, nextTick } from 'vue';
import { exbitMenuShow, exbitListMenuShow } from '@/hooks/menuHooks';
import { useProjectStore } from '@/store';
import { getLinkUrl } from '@/utils/request/upload';

const emit = defineEmits([
  'emitChildItemDraggable',
  'emitChildItemDraggableStyle',
  'emitShowcaseDraggable',
  'emitShowcaseDraggableStyle',
  'onContextMenuChild',
]);
const store = useProjectStore();
const contextMenuTrigger = ref(); //列表盒子dom
const parentLock = ref(true);
const childShow = ref(true);
const draggableResizable = ref(); //父级拖拽盒子ref
const timer = ref();
const ImgVisible = ref(false);
const ImgUrl = ref('');

const props = defineProps({
  width: {
    type: Number || String,
  },
  height: {
    type: Number || String,
  },
  indexs: {
    type: Number,
  },
  info: {
    type: Object,
  },
  childId: {
    type: Number,
  },
  AuxiliaryId: {
    type: Number,
  },
});

const viewImg = (moduleId: number, e?: number) => {
  store.exhibitsModuleId = moduleId;
  store.exhibitsShowpieceid = e;
  store.exhibitsInfoShow = true;
};

const handleMouseDown = (event) => {
  event.stopPropagation();
};
const preventDefaultDrag = (event) => {
  event.stopPropagation();
};
// watch(
//   () => props.info.width,
//   () => {
//     childShow.value = false;
//     nextTick(() => {
//       childShow.value = true;
//     });
//   },
//   { deep: true },
// );
// watch(
//   () => props.info.height,
//   () => {
//     childShow.value = false;
//     nextTick(() => {
//       childShow.value = true;
//     });
//   },
//   { deep: true },
// );

//
</script>
   
<style lang="less" scoped>
.exhibits-content {
  position: relative;
  display: flex;
  z-index: 999;
  padding: 0 0.1rem !important;
}
.list {
  display: flex;
  width: 100%;
  height: 100%;
}
.decoration-box {
  width: 553px;
  height: 651px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  margin-right: 90px;
  -webkit-box-reflect: below 0% linear-gradient(transparent, rgba(0, 0, 0, 0.3));
}
.list-content {
  display: flex;
  flex: 1;
  margin-top: 177px;
  height: 643px;
  -webkit-box-reflect: below 0% linear-gradient(transparent, rgba(0, 0, 0, 0.3));
  background-repeat: repeat;
  background-size: auto 100%;
}
.list-left,
.list-right {
  width: 143px;
  height: 643px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.active {
  :deep(.flot-menu) {
    display: flex;
  }
}
:deep(.active) {
  z-index: 999;
}
:deep(.vdr-handle) {
  z-index: 66;
}

.exhibits-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  width: 332px;
  height: 643px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  perspective: 1000px;
}

.item-content {
  position: relative;
  display: flex;
  flex-direction: column;

  width: 332px;
  height: 295px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  margin: 0 auto;
  perspective: 1000px;
}

.cover-box {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  width: 220px;
  height: 220px;
  overflow: hidden;
  margin-left: 64px;
  margin-top: 4px;
  background-repeat: no-repeat;
  background-size: 100% 100%;

  // border: 1px solid rgba(63, 95, 92, 1);
  // box-shadow: 0px 0px 3.64px 0px rgba(141, 160, 156, 1);
  // background: rgba(225, 231, 225, 1);
}
.flip-box {
  perspective: 1000px;
  width: 220px;
  height: 220px;
}

.flip-box-inner {
  position: relative;
  width: 220px;
  height: 220px;
  text-align: center;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.flip-box:hover .flip-box-inner {
  transform: rotateY(180deg);
}

.flip-box-front,
.flip-box-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.flip-box-front-content {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 220px;  
  height: 220px; 
}  
.flip-box-back { 
  padding: 86px 15px;
  transform: rotateY(180deg); 
  :deep(p) {
    width: 100%;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2; /* 限制显示的文本行数为2 */
    overflow: hidden; /* 隐藏超出部分 */
    text-overflow: ellipsis; /* 使用省略号表示被截断的文本 */
    max-height: 48px;
    line-height: 24px;
    font-family: SourceHanSerifCN-Bold;
    font-size: 18px;
    color: rgba(245, 246, 242, 1);
    text-align: center;
  }
}
.cover {
  width: 210px;
  height: 160px;
  object-fit: contain;
  transition: all 0.3s;
}

.items-title {
  // z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 0;
  left: 0;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  width: 220px;
  height: 220px;
  padding: 86px 15px;

  :deep(p) {
    width: 100%;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2; /* 限制显示的文本行数为2 */
    overflow: hidden; /* 隐藏超出部分 */
    text-overflow: ellipsis; /* 使用省略号表示被截断的文本 */
    max-height: 48px;
    line-height: 24px;
    font-family: SourceHanSerifCN-Bold;
    font-size: 18px;
    color: rgba(245, 246, 242, 1);
    text-align: center;
  }
}
// .cover-box:hover {
//   .items-title {
//     opacity: 1;
//   }
// }
</style>
